package de.fhwf.mixedreality.client;

public interface IClient {
  /* team colors */
	public enum Team { BLUE, YELLOW };	
	/* game modes */
	public enum GameMode { FROZEN, PLAY_ON, KICK_OFF, GOAL_KICK_OWN, GOAL_KICK_OPPONENT, CORNER_KICK_OWN, CORNER_KICK_OPPONENT, TEAM_ADJUSTMENT };
	/* player per team */
	public final static int MAX_PLAYERS = 11;

	/**
	 * This function establishes the connection to the server and should be called
	 * once after the object was created.
	 */
	public abstract boolean connect();

	/**
	 * This function should be called on the beginning of every cycle of the main
	 * loop. It receives information from the server and updates the situation of
	 * known objects around the field. This function returns -1 if the server
	 * stopped.
	 */
	public abstract boolean update();

	public abstract boolean update(String serverData);

	/**
	 * This function should be called in the end of every cycle of the main loop.
	 * It takes the desired speeds or raw commands and send them to the server for
	 * making the robot actually move.
	 */
	public abstract void flush();

	/**
	 * This function disconnects the client and should be called before finishing
	 * the program
	 */
	public abstract void close();

	/** Returns the object which is used to issue commands to the bot */
	public abstract IMovements getMovements();

	/** Returns the object which is used to issue commands to the bot */
	public abstract IMovements Movements();

	/**
	 * Returns the object which contains the current positions of all elements in
	 * the world and calculations functions for them
	 */
	public abstract IPositionsStorage getPositions();

	/**
	 * Returns the object which contains the current positions of all elements in
	 * the world and calculations functions for them
	 */
	public abstract IPositionsStorage Positions();

	/** Returns the time of last update in the server clock, in seconds */
	public abstract double time();

	/** Returns true if the game is on or false if not */
	public abstract boolean isGameOn();
	
	/** Returns the current game mode (kick off etc.) */
	public abstract GameMode getGameMode();

	/** Return the id (a.k.a. t-shirt number) of one's self */
	public abstract int myID();

	/**
	 * Tells whether you are lost or not. Being lost happens when the robot is
	 * removed from the field or if the camera cannot find it for any reason.
	 */
	public abstract boolean iAmLost();

	/**
	 * Tells if a given opponent was found in the field
	 * 
	 * @param id
	 *          The ID of the opponent to look for
	 */
	public abstract boolean isOpponentFound(int id);

	/**
	 * Tells if a given teammate was found in the field
	 * 
	 * @param id
	 *          The ID of the teammate to look for
	 */
	public abstract boolean isTeammateFound(int id);

	public abstract int goalsTeam();

	public abstract int goalsOpponents();

	public abstract IView getView();

	public abstract void setView(IView newView);

	public abstract boolean isSimulated();

	public abstract String peekCmd();

	public abstract String getLastCmd();

	public abstract String getServerAddress();

	public abstract int getServerPort();

	public abstract void setBotName(String name);

	public abstract String getBotName();

	public abstract void setTeamName(String name);

	public abstract String getTeamName();
	
}